﻿@inherits EditOperationDialogBase<AttachmentDto, Guid, AttachmentLocalResource>
@if (_editModel != null)
{
<Form Loading="@_dialogLoading.Value"
      Model="@_editModel"
      LabelCol="new ColLayoutParam { Span = 8 }"
      WrapperCol="new ColLayoutParam { Span = 16 }"
      OnFinish="OnFormFinish"
      Context="model">
    <FormItem Label="@base.Localizer[AttachmentLocalResource.Id]">
        <Input @bind-Value="@model.Id" Disabled />
    </FormItem>
         <FormItem Label="@base.Localizer[AttachmentLocalResource.BusinessId]">
        <Input @bind-Value="@model.BusinessId" Disabled />
    </FormItem>
         <FormItem Label="@base.Localizer[AttachmentLocalResource.BusinessType]">
        <SimpleSelect @bind-Value="@_currentEditModelBusinessType"
                      DefaultValue="@(model.BusinessType.ToString())"
                      Style="">
            <SelectOptions>
                @foreach (var gitem in EnumHelper.EnumToDictionary<AttachmentBusinessType>())
                {
                    <SimpleSelectOption Value="@(gitem.Key.ToString())" Label="@(gitem.Value)"></SimpleSelectOption>
                }
            </SelectOptions>
        </SimpleSelect>
    </FormItem>
        <FormItem Label="@base.Localizer[AttachmentLocalResource.ContentType]">
        <Input @bind-Value="@model.ContentType" />
    </FormItem>
        <FormItem Label="@base.Localizer[AttachmentLocalResource.FileType]">
        <SimpleSelect @bind-Value="@_currentEditModelFileType"
                      DefaultValue="@(model.FileType.ToString())"
                      Style="">
            <SelectOptions>
                @foreach (var gitem in EnumHelper.EnumToDictionary<AttachmentFileType>())
                {
                    <SimpleSelectOption Value="@(gitem.Key.ToString())" Label="@(gitem.Value)"></SimpleSelectOption>
                }
            </SelectOptions>
        </SimpleSelect>
    </FormItem>
        <FormItem Label="@base.Localizer[AttachmentLocalResource.OriginalName]">
        <Input @bind-Value="@model.OriginalName" />
    </FormItem>
    <FormItem Label="@base.Localizer[AttachmentLocalResource.Name]">
        <Input @bind-Value="@model.Name" />
    </FormItem>
        <FormItem Label="@base.Localizer[AttachmentLocalResource.Suffix]">
        <Input @bind-Value="@model.Suffix" />
    </FormItem>
        <FormItem Label="@base.Localizer[AttachmentLocalResource.Size]">
        <Input @bind-Value="@model.Size" />
    </FormItem>
        <FormItem Label="@base.Localizer[AttachmentLocalResource.Path]">
        <Input @bind-Value="@model.Path" />
    </FormItem>
        <FormItem Label="@base.Localizer[AttachmentLocalResource.Url]">
        <Input @bind-Value="@model.Url" />
    </FormItem>

    @if (this.Options.Type.Equals(OperationDialogInputType.Edit) || this.Options.Type.Equals(OperationDialogInputType.Select))
    {
        <FormItem Label="@Localizer[SharedLocalResource.CreatedTime]">
            <span>@model.CreatedTime.ToString(ClientConstant.DateTimeFormat)</span>
        </FormItem>
        <FormItem  Label="@Localizer[SharedLocalResource.UpdatedTime]">
            <span>@model.UpdatedTime?.ToString(ClientConstant.DateTimeFormat)</span>
        </FormItem>
    }
    <FormItem WrapperColOffset="8" WrapperColSpan="16">
        <Space>
            <SpaceItem>
                <Button OnClick="_=>OnFormCancel()">
                    @Localizer[SharedLocalResource.Cancel]
                </Button>
            </SpaceItem>
        </Space>
    </FormItem>
</Form>
}